package com.minivision.fdiot.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonFormat;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Entity
@Setter
@Getter
@ToString(callSuper = true)
@EntityListeners(AuditingEntityListener.class)
public class Device extends BaseEntity {
  
  private static final long serialVersionUID = 610743298425298293L;
  
  @Column(unique = true, nullable = false)
  @ApiModelProperty(value = "设备编号")
  private String sn;
  @ApiModelProperty(value = "设备名称")
  private String name;
  @Column(nullable = false)
  @ApiModelProperty(value = "设备类型：box（商圈）、pad（门禁）")
  private String model;
  
  @Column(nullable = false)
  @ApiModelProperty(value = "应用标识")
  private String appKey;

  @ApiModelProperty(value = "设备当前绑定的人脸库,为Map<String,String>格式，key 为facesetToken,value 为FaceSet json")
  private String facesetTokens;

  @ApiModelProperty(value = "设备是否在线")
  private Boolean online = false;
  @ApiModelProperty(value = "设备是否激活")
  private Boolean activated = false;
  
  @ApiModelProperty(value = "设备当前连接的服务节点，ip:port")
  private String connectNode;
  
  @Temporal(TemporalType.TIMESTAMP)
  @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  @ApiModelProperty(value = "设备激活时间")
  private Date activateTime;
  
}
